package com.leo.utilsProject;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.leo.utils.FileUtils;

import java.io.File;
import java.io.IOException;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    private Button mBtText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mBtText = (Button) findViewById(R.id.btTest);
        mBtText.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        boolean isCreate = FileUtils.createFile(Environment.getExternalStorageDirectory().getPath(),"/testtest.text");
        Toast.makeText(this,isCreate+"",Toast.LENGTH_SHORT).show();
        try {
            FileUtils.move(new File(Environment.getExternalStorageDirectory().getPath()+File.separator+"testtest.text"),new File(Environment.getExternalStorageDirectory().getPath()+"/ss"+File.separator+"testtest.text"));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
